pub fn longest_common_prefix(strs: Vec<String>) -> String {
    if strs.len() == 1 {
        return strs[0].clone();
    }

    // 最小长度
    let mut min_length = usize::max_value();

    // 获取最小长度
    for str in &strs {
        if min_length > str.len() {
            min_length = str.len();
        }
    }

    let mut start = 0;
    let mut end = min_length;

    'outer: loop {
        if start >= end {
            break;
        }
        let mid_length = (end - start + 1) / 2 + start;
        let mid_str = &strs[0][0..mid_length];

        for str in &strs {
            if !str.starts_with(mid_str) {
                end = mid_length - 1;
                continue 'outer;
            }
        }

        start = mid_length;
    }

    return strs[0][0..start].to_string();
}
